home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
program
/
qlib205.zip
/
QLIB.ZIP
/
SRC
/
STARTUP
/
C0C1.ASM
< prev
next >
Wrap
Assembly Source File
|
1997-07-08
|
1KB
|
78 lines
;common file #1
;included by c0.asm
;setup _argv & _argstr
mov esi,_psp
add esi,80h
mov edi,offset _argstr
lodsb ;al=size!
; ch=flag:start of new arg?
; cl=flag:inside ""
xor ecx,ecx
mov edx,1
and al,7fh ;ensure no error
jz done
mov ebx,_argv ;the [_argv+0] = file name (set later)
add ebx,4
@@1:
cmp byte ptr[esi],'"'
jz quote
.if !cl ;check only if we are not in quotes
cmp byte ptr[esi],32 ;seperators
jz @f
cmp byte ptr[esi],9
jz @f
cmp byte ptr[esi],255
jz @f
.endif
or ch,ch
jnz notnew
;new string
inc ch ;set flag:inside string (arg)
inc edx
mov [ebx],edi
add ebx,4
notnew:
movsb
dec al
jz done
jmp @@1
quote:
.if cl
xor cl,cl
.else
inc cl
.endif
inc esi
dec al
jz done
jmp @@1
@@:
.if ch
xor ch,ch ;clear flag:not at start
mov byte ptr [edi],0
inc edi
.endif
inc esi
dec al
jz done
jmp @@1
done:
mov byte ptr [edi],0
mov dptr _argc,edx
mov esi,_environ
;search for double 0
dec esi
@@:
inc esi
cmp word ptr[esi],0
jnz @b
add esi,4 ;skip 0/0/word
mov _filename,esi
mov ebx,_argv
mov [ebx+0],esi